﻿@using Kunlun.BusinessLogic
@using Kunlun.Models;
@model Kunlun.ViewModels.ProductsViewModels
@{
	ViewBag.Title = @Model.Products.SeoPageName + @Model.Products.Name + @Model.Products.SeoPageName;
	Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
	<meta name="keywords" content="@Model.Products.Seokeyword"/>
	<meta name="description" content="@Model.Products.SeoDescription"/>
	<link href="@Url.Content("~/Content/Product/StyleSheet.css")" type="text/css" rel="Stylesheet" />
	<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" type="text/css" rel="Stylesheet" />
	<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
	<link href="@Url.Content("~/Content/base/basic.css")" type="text/css" rel="Stylesheet" />
	<script src="@Url.Content("~/Content/base/jquery.simplemodal.js")" type="text/javascript"></script>
	<link href="@Url.Content("~/Content/base/ymPrompt.css")" type="text/css" rel="Stylesheet" />
	<script src="@Url.Content("~/Content/base/Prompt.js")" type="text/javascript"></script>
	<script type="text/javascript">
       $(function () {
            
            $("#PFBMidLeft").tabs();
        
           //默认选择第一个规格
           var object = $(".size dd");
           $(".size dd:first").addClass("selected")
           var dataprice1 = parseFloat($(".size dd a").attr("data-price1"));

           var dataprice2 = parseFloat($(".size dd a").attr("data-price2"));

           var dataid = $(".size dd a").attr("data-id");
           
           var image="@string.Format("{0}{1}", "http://manage.kaca.com", @ProductImageToThum.Show(Model.Products.ViewPic))";
           var w=0;var h=0;

           $("#price").html("海报价格:￥"+parseFloat(dataprice2)+"元<br /> 无框画价格价格：￥" + parseFloat(dataprice1) + " 元");

         

           //预览产品图片
           $(".ImageLink").click(function () {
               var imageurl = $(this).attr("data-image");
               $(".postion").html("<div style=\"background-image: url(/Content/themes/"+imageurl+".jpg); width:430px; height:430px;\" ><img class=\"viewimage\" src="+image+" /></div>");
               
           });
           //预览产品图片
           $(".ViewImageLink").click(function () {               
               $(".postion").html("<img style=\"position:absolute;left:"+(430-w)/2+"px; top:"+(430-h)/2+"px;\"  src="+image+" />");
               
               
           });

           //客人选择规格
           $(".size dd a").live("click", function () {
               dataprice1 = parseFloat($(this).attr("data-price1"));
               dataprice2 = parseFloat($(this).attr("data-price2"));
               dataid = $(this).attr("data-id");
               if (object != null)
               { eval(object).removeClass("selected") }
               $(this).parent().addClass("selected")
               object = $(this).parent();
               
               $("#price").html("海报价格:￥"+parseFloat(dataprice2)+"元<br /> 无框画价格价格：￥" + parseFloat(dataprice1 + dataprice1) + " 元");
           });

           //定制框画
           $(".nowmake").click(function () {
               window.open("/Frame?pid=@Model.Products.pid&attid="+dataid);
           });

           //产品预览图高和宽

            $(".postion img:first-child").load(function(){
                 w=this.width;h=this.height; 
                 $(this).css("position","absolute").css("left",(430-w)/2).css("top",(430-h)/2);              
                
            });
            //无框画订购
            $(".noframe").click(function(){
                 $.post("/MyKunlun/Cart", { "info": "@Model.Products.pid," + dataid + ",@Convert.ToInt32(FrameType.无框画),0,0,1,0"},
                    function (data) {
                        if(data)
                        {
                            Alert("已经放入购物车！");
                       }

                    });
            });
            //海报订购
			$(".oilpaint").click(function(){
            $.post("/MyKunlun/Cart", { "info":  "@Model.Products.pid," + dataid + ",@Convert.ToInt32(FrameType.海报),0,0,1,0"},
                    function (data) {
                        if(data)
                        {
                            Alert("已经放入购物车！");
                        }

                    });
            });
			$(".crystal").click(function(){
            $.post("/MyKunlun/Cart", { "info":  "@Model.Products.pid," + dataid + ",@Convert.ToInt32(FrameType.水晶画),0,0,1,0"},
                    function (data) {
                        if(data)
                        {
                           Alert("已经放入购物车！");
                        }

                    });
            });
       });
      function ChangeBig(obj,src){

		$(".img_div").html("<img onload='DrawImage(this,500,500)'  src='" + src + "'/>");
		$("#imgBody ul li").each(function(){
			$(this).attr("class","");
		});
		$(obj).attr("class","sel");
	  }

	function AddCollection(){
		$.post("/MyKunlun/InsertCollection", { "pid":  "@Model.Products.pid"},
                function (data) {
                    Alert(data);

                    });
          
	  }
	</script>
}
<!-- content -->
<div class="goods_conetnt">
	<div class="left_div">
		<div class="img_div">
			<img alt="@Model.Products.Name" onload='DrawImage(this,500,500)' src="@string.Format("{0}{1}", WebLog.ImageHttp,Model.Products.ViewPic)" />
		</div>
		@*<div id='leftBt' onclick="scrol()" class="no_img">
		</div>*@
		<div id='imgBody' style='width: 560px;'>
			<ul>
			@*	<li class="sel" onmouseover="ChangeBig(0,this)">
					<img alt="" src="@string.Format("{0}{1}", WebLog.ImageHttp, Model.Products.ViewPic)"/>
				</li>
				<li onmouseover="ChangeBig(1,this)">
					<img alt="" src="@Url.Content("~/Content/themes/Small-1.jpg")"  />
				</li>
				<li onmouseover="ChangeBig(2,this)">
					<img alt="" src="@Url.Content("~/Content/themes/Small-2.jpg")" />
				</li>
				<li onmouseover="ChangeBig(3,this)">
					<img alt="" src="@Url.Content("~/Content/themes/Small-3.jpg")" />
				</li>
				<li onmouseover="ChangeBig(4,this)">
					<img alt="" src="@Url.Content("~/Content/themes/Small-4.jpg")"/>
				</li>*@
				@{
			int i = 0;
			foreach (Product_pic pic in Model.Products.Product_pic) {
						if (i == 0) {
							<li class='sel' onmouseover="ChangeBig(this,'@string.Format("{0}{1}", WebLog.ImageHttp, Model.Products.ViewPic)')"><img alt="" src="@string.Format("{0}{1}",WebLog.ImageHttp,pic.ThumUrl)"/></li>
						} else {
							<li onmouseover="ChangeBig(this,'@string.Format("{0}{1}",WebLog.ImageHttp,pic.ThumUrl)')"><img alt="" src="@string.Format("{0}{1}",WebLog.ImageHttp,pic.ThumUrl)"/></li>
						}
						i++;
					}
				}
			</ul>
		</div>
			@*@{
				if (Model.Products.Product_pic.Count > 7) 
				{
				<div id='rightBt' onclick='scror()'></div>
				} else 
				{
				<div id='rightBt' class='no_img'></div>
				}
			 }	*@		
	</div>
	<div class="right_div">
		<h2>@Model.Products.Name</h2>
		<ul class="attr">
		 <li>类型：@foreach (Category c in Model.Categorys)
		  {
				<a href="@Url.Content("~/Store/Frame/Search?Classid=" + c.ID)">@c.Cname</a>
		  }
		  </li>
		  </ul>
		<dl class="size" id="GoodsSize">
			<dt>商品规格</dt>
			@if (Model.Products.Product_attributes != null)
			   {
				   foreach (var item in Model.Products.Product_attributes)
				   { 
				<dd>
					<a href="javascript:var i=0;" class="AttrName"  data-id="@item.ID" data-price1="@item.Value1" data-price2="@item.Value2">@item.Title
						| 无框画价格： <span>@string.Format("{0:F}", item.Value1)</span>| 海报价格：<span>@string.Format("{0:F}", item.Value2)</span></a>
				</dd>
				   }
			   }
		</dl>
		<p>
			画片关键字：@Model.Products.Keywords</p>
		<ul class="PFConBuy">
			<li><a href="javascript:var i=0;" class="nowmake">自定义框画</a></li>
			<li><a href="javascript:var i=0;" class="noframe">购买无框画</a>-属于成品画已经装裱,可直接用于墙面装饰</li>
			<li><a href="javascript:var i=0;" class="oilpaint">购买海报</a></li>
			<li><a href="javascript:var i=0;" class="crystal">购买水晶画</a></li>
		</ul>
		<p id="price">
		</p>
		<ul class="action_button">
			<li class="bt1" onclick='location.href="@Url.Content("~/MyKunlun/Recommend")";'>推荐好友</li>
			<li class="bt2" onclick="AddCollection()">加入收藏</li>
			<li class="bt3" onclick='location.href="@Url.Content("~/Help/Question/8")"'>送货说明</li>
		</ul>
	</div>
	<div id="PFBMid">
		<div id="PFBMidLeft">
			<ul>
				<li><a href="#tabs-1">商品介绍</a></li>
				@*<li><a href="#tabs-2">购买评价</a></li>
            <li><a href="#tabs-3">疑难提问</a></li>
            <li><a href="#tabs-4">售后服务</a></li>*@
			</ul>
			<div class="tabs">
				@if (Model.Products.Product_propertys.Count > 0)
	{
					<ul class="propertys-list">
						@foreach (Product_propertys item in Model.Products.Product_propertys)
	  {
							<li title='@item.Value'>@item.Cname:@item.Value</li>
	  }
					</ul>
	}
				<div class="remark">
					@Model.Products.Contents
				</div>
				<ul class="cimg">
					@*<li class="back1">
						<img onload='DrawImage(this,200,200)' src="@string.Format("{0}{1}", System.Configuration.ConfigurationManager.AppSettings["ImageHttp"], Model.Products.ViewPic)" /></li>
					<li class="back2">
						<img onload='DrawImage(this,200,200)' src="@string.Format("{0}{1}", System.Configuration.ConfigurationManager.AppSettings["ImageHttp"], Model.Products.ViewPic)" /></li>
					<li class="back3">
						<img onload='DrawImage(this,200,200)' src="@string.Format("{0}{1}", System.Configuration.ConfigurationManager.AppSettings["ImageHttp"], Model.Products.ViewPic)" /></li>
					<li class="back4">
						<img onload='DrawImage(this,200,200)' src="@string.Format("{0}{1}", System.Configuration.ConfigurationManager.AppSettings["ImageHttp"], Model.Products.ViewPic)" /></li>*@
					@foreach (Product_pic pic in Model.Products.Product_pic)
	 {
						<li>
							<img onload='DrawImage(this,500,500)' src="@string.Format("{0}{1}", WebLog.ImageHttp, @pic.ListPicUrl)" />
						</li>
		
	 }</ul>
			</div>
		</div>
		<div id="PFBMidRight">
			@Html.Action("ReadHisCookie")
		</div>
	</div>
	<div class="PFRList">
		@{Html.RenderAction("RelationProduct", "Frame", new { cid = Model.Products.Classid.Split(',')[1].ToString() });}
	</div>
</div>
